function data=gcpick_loadsacdata(CONFIG)
%loadsac - load sac datas
path = CONFIG.datapath;
list = dir([path, '/*.SAC']);
tem = [];
station = {};
for i=1:length(list)
    file = gcpick_readdatafile([ list(i).folder, '/', list(i).name ]);
    tem= [tem, file];
    station = [station, file.station];
end
uniq_station = unique(station);
N = length(uniq_station);
data = [];
for i = 1:N
    files = tem( ismember(station, uniq_station{i}) );
    dataUnit = rmfield(files(1), {'axis', 'wave'});
    dataUnit.tp = -1;
    dataUnit.ts = -1;
    dataUnit.E = [];
    dataUnit.N = [];
    dataUnit.Z = [];
    dataUnit.polar.E = 0;
    dataUnit.polar.N = 0;
    dataUnit.polar.Z = 0;
    for j = 1:length(files)
        switch files(j).axis
            case 'E'
                dataUnit.E = files(j).wave;
            case 'N'
                dataUnit.N = files(j).wave;
            case 'Z'
                dataUnit.Z = files(j).wave;
        end
    end
    data = [data, dataUnit];
end
disp('sac data loaded.');
end